package com.jdkreader.list;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

/**
 * @Description: 迭代器remove操作
 * @Author: wuzhaoyi
 * @Date: 2019/4/3 11:13 AM
 * @Version: 1.0
 */
public class IteratorRemove {

    public static void main(String[] args) {

        List<String> list = Arrays.asList("a","b","c");

        Iterator<String> stringIterator = list.iterator();

        //对于Arrays.asList生成的列表遍历，迭代器使用的是AbstractList的内部迭代器实现类Itr
        while(stringIterator.hasNext()){
            stringIterator.remove();
        }

    }
}
